Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Azure MSI & Metadata Service token sources to httpclient and add 100% test coverage #709

Merged
merged 2 commits into from
Dec 1, 2023

Conversation

nfx
Copy link
Contributor

@nfx nfx commented Nov 24, 2023

This PR improves the stability for Azure MSI authentication by adopting the httpclient transport.

Needs two PRs merged first:

@nfx nfx requested a review from mgyucht November 24, 2023 19:36
@nfx nfx marked this pull request as ready for review November 27, 2023 09:30
Base automatically changed from feat/envs to main November 28, 2023 12:46
@nfx nfx changed the title Migrate Azure MSI token source to httpclient and add 90% test coverage Migrate Azure MSI & Metadata Service token sources to httpclient and add 100% test coverage Nov 28, 2023
@codecov-commenter
Copy link

codecov-commenter commented Nov 28, 2023

Codecov Report

Attention: 32 lines in your changes are missing coverage. Please review.

Comparison is base (e86cbfd) 16.86% compared to head (d7a8895) 17.57%.

Files Patch % Lines
config/azure.go 55.00% 16 Missing and 2 partials ⚠️
httpclient/fixtures/fixture.go 20.00% 8 Missing ⚠️
httpclient/fixtures/map_transport.go 40.00% 2 Missing and 1 partial ⚠️
config/config.go 90.00% 1 Missing and 1 partial ⚠️
httpclient/errors.go 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #709      +/-   ##
==========================================
+ Coverage   16.86%   17.57%   +0.71%     
==========================================
  Files         103      103              
  Lines       14128    14188      +60     
==========================================
+ Hits         2383     2494     +111     
+ Misses      11536    11489      -47     
+ Partials      209      205       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nfx
Copy link
Contributor Author

nfx commented Nov 28, 2023

go 1.19 doesn't support multiple errors unwrapping
image
image

Copy link
Contributor

@mgyucht mgyucht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good, a couple comments/suggestions/questions.

config/environments.go Outdated Show resolved Hide resolved
config/config.go Show resolved Hide resolved
httpclient/api_client.go Show resolved Hide resolved
config/azure.go Outdated Show resolved Hide resolved
config/azure.go Show resolved Hide resolved
config/azure.go Show resolved Hide resolved
httpclient/errors.go Show resolved Hide resolved
Copy link
Contributor

@mgyucht mgyucht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After offline discussion, LGTM, please add docs for that one parameter and feel free to merge.

This PR improves the stability for Azure MSI authentication by adopting the httpclient transport.

add 100% coverage for MSI & metadata-service

..

..

..
@nfx
Copy link
Contributor Author

nfx commented Dec 1, 2023

tested as github.com/databricks/databricks-sdk-go v0.26.2-0.20231201114025-d7a8895217fe and confirm that this PR is working as expected

@nfx nfx added this pull request to the merge queue Dec 1, 2023
Merged via the queue into main with commit 82d089a Dec 1, 2023
4 checks passed
@nfx nfx deleted the feat/token-refreshers branch December 1, 2023 19:45
mgyucht added a commit that referenced this pull request Dec 7, 2023
This is a bugfix release, including a fix correcting issues with OAuth flows, due to a bug with the propagation of the response status in `httpclient`'s `RoundTrip()` implementation. This fixes the `failed during request visitor: token: oauth2: cannot fetch token: Response: {...}` error.

All fixes:

* Migrate Azure MSI & Metadata Service token sources to `httpclient` and add 100% test coverage ([#709](#709)).
* Added `config.NewAzureCliTokenSource` and `config.NewAzureMsiTokenSource` constructors ([#727](#727)).
* Use per-config refresh context for OAuth tokens ([#728](#728)).
@mgyucht mgyucht mentioned this pull request Dec 7, 2023
github-merge-queue bot pushed a commit that referenced this pull request Dec 7, 2023
This is a bugfix release, including a fix correcting issues with OAuth
flows, due to a bug with the propagation of the response status in
`httpclient`'s `RoundTrip()` implementation. This fixes the `failed
during request visitor: token: oauth2: cannot fetch token: Response:
{...}` error.

All fixes:

* Migrate Azure MSI & Metadata Service token sources to `httpclient` and
add 100% test coverage
([#709](#709)).
* Added `config.NewAzureCliTokenSource` and
`config.NewAzureMsiTokenSource` constructors
([#727](#727)).
* Use per-config refresh context for OAuth tokens
([#728](#728)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants